#include "ScrGame.h"
#include "Renderer.h"
#include "ScreenManager.h"
#include "Game.h"
#include "base.h"
#include "Utils.h"

//Blocks
#include "BlockGrass.h"
#include "BlockSolid.h"

uint ScrGame::blockGravel = 0;
uint ScrGame::blockStone = 0;
uint ScrGame::blockDirt = 0;
uint ScrGame::blockPlanks = 0;
uint ScrGame::blockGrass = 0;
uint ScrGame::blockWood = 0;
uint ScrGame::blockCobble = 0;
uint ScrGame::blockBedrock = 0;

#define REGISTER_BLOCK(blockDef) m_pBlocks->RegisterBlockTemplate(BlockTemplatePtr(new blockDef), this);

int ScrGame::RegisterBlockTemplates()
{
	blockGravel = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 0, "gravel"));
	blockStone = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 1, "stone"));
	blockDirt = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 2, "dirt"));
	blockGrass = REGISTER_BLOCK(BlockGrass(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 2, 40, 3));
	blockPlanks = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 4, "planks"));
	blockBedrock = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 17, "bedrock"));
	REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 6, "stoneSlab"));
	REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 7, "brick"));
	REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 8, "tnt"));
	blockWood = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 21, "wood"));
	blockCobble = REGISTER_BLOCK(BlockSolid(m_pBlocks->GetFreeBlockID(), m_nTextureTerrain, 16, "cobble"));
	return CL_OK;
}